/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package idea.model.qnrlibrary;


import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;


/**
 *
 * @author rejun001
 */
@Entity
@Table( name = "category_content" )
@XmlRootElement
@NamedQueries( 
{
    @NamedQuery( name = "CategoryContent.findAll" , query = "SELECT c FROM CategoryContent c" ) ,
    @NamedQuery( name = "CategoryContent.findByCategoryContentId" , query = "SELECT c FROM CategoryContent c WHERE c.categoryContentId = :categoryContentId" ) ,
    @NamedQuery( name = "CategoryContent.findByCategoryType" , query = "SELECT c FROM CategoryContent c WHERE c.categoryType = :categoryType" ) ,
    @NamedQuery( name = "CategoryContent.findByContentType" , query = "SELECT c FROM CategoryContent c WHERE c.contentType = :contentType" ) ,
    @NamedQuery( name = "CategoryContent.findByCreatedBy" , query = "SELECT c FROM CategoryContent c WHERE c.createdBy = :createdBy" ) ,
    @NamedQuery( name = "CategoryContent.findByDateCreated" , query = "SELECT c FROM CategoryContent c WHERE c.dateCreated = :dateCreated" ) ,
    @NamedQuery( name = "CategoryContent.findByModifiedBy" , query = "SELECT c FROM CategoryContent c WHERE c.modifiedBy = :modifiedBy" ) ,
    @NamedQuery( name = "CategoryContent.findByDateModified" , query = "SELECT c FROM CategoryContent c WHERE c.dateModified = :dateModified" )
} )
public class CategoryContent implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @Basic( optional = false )
    @Column( name = "category_content_id" )
    private String categoryContentId;
    @Basic( optional = false )
    @Column( name = "category_type" )
    private String categoryType;
    @Basic( optional = false )
    @Column( name = "content_type" )
    private String contentType;
    @Basic( optional = false )
    @Column( name = "created_by" )
    private String createdBy;
    @Basic( optional = false )
    @Column( name = "date_created" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date dateCreated;
    @Column( name = "modified_by" )
    private String modifiedBy;
    @Column( name = "date_modified" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date dateModified;
    @OneToMany( cascade = CascadeType.ALL , mappedBy = "categoryContentId" )
    private Collection<QuestionTitle> questionTitleCollection;
    @JoinColumn( name = "category_id" , referencedColumnName = "category_id" )
    @ManyToOne( optional = false )
    private Categories categoryId;


    public CategoryContent()
    {
    }


    public CategoryContent( String categoryContentId )
    {
        this.categoryContentId = categoryContentId;
    }


    public CategoryContent( String categoryContentId , String categoryType , String contentType , String createdBy , Date dateCreated )
    {
        this.categoryContentId = categoryContentId;
        this.categoryType = categoryType;
        this.contentType = contentType;
        this.createdBy = createdBy;
        this.dateCreated = dateCreated;
    }


    public String getCategoryContentId()
    {
        return categoryContentId;
    }


    public void setCategoryContentId( String categoryContentId )
    {
        this.categoryContentId = categoryContentId;
    }


    public String getCategoryType()
    {
        return categoryType;
    }


    public void setCategoryType( String categoryType )
    {
        this.categoryType = categoryType;
    }


    public String getContentType()
    {
        return contentType;
    }


    public void setContentType( String contentType )
    {
        this.contentType = contentType;
    }


    public String getCreatedBy()
    {
        return createdBy;
    }


    public void setCreatedBy( String createdBy )
    {
        this.createdBy = createdBy;
    }


    public Date getDateCreated()
    {
        return dateCreated;
    }


    public void setDateCreated( Date dateCreated )
    {
        this.dateCreated = dateCreated;
    }


    public String getModifiedBy()
    {
        return modifiedBy;
    }


    public void setModifiedBy( String modifiedBy )
    {
        this.modifiedBy = modifiedBy;
    }


    public Date getDateModified()
    {
        return dateModified;
    }


    public void setDateModified( Date dateModified )
    {
        this.dateModified = dateModified;
    }


    @XmlTransient
    public Collection<QuestionTitle> getQuestionTitleCollection()
    {
        return questionTitleCollection;
    }


    public void setQuestionTitleCollection( Collection<QuestionTitle> questionTitleCollection )
    {
        this.questionTitleCollection = questionTitleCollection;
    }


    public Categories getCategoryId()
    {
        return categoryId;
    }


    public void setCategoryId( Categories categoryId )
    {
        this.categoryId = categoryId;
    }


    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += ( categoryContentId != null ? categoryContentId.hashCode() : 0 );
        return hash;
    }


    @Override
    public boolean equals( Object object )
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if ( !( object instanceof CategoryContent ) )
        {
            return false;
        }
        CategoryContent other = (CategoryContent) object;
        if ( ( this.categoryContentId == null && other.categoryContentId != null ) || ( this.categoryContentId != null && !this.categoryContentId.equals( other.categoryContentId ) ) )
        {
            return false;
        }
        return true;
    }


    @Override
    public String toString()
    {
        return "idea.model.qnrlibrary.CategoryContent[ categoryContentId=" + categoryContentId + " ]";
    }
    
}
